package com.iot.common.enums;

public enum DeviceStatusType {

    BOOT_UP(1, "开机"),
    SHUT_DOWN(2, "关机"),
    DEVICE_RUN(3, "运行"),
    DEVICE_RUN_STOP(4, "停止运行"),
    FAILURE(5, "报警"),
    STOP_FAILURE(6, "停止报警"),
            ;

    private final int number;
    private final String character;

    DeviceStatusType(int number, String character) {
        this.number = number;
        this.character = character;
    }

    public int getNumber() {
        return number;
    }

    public String getCharacter() {
        return character;
    }

    // 通过数字获取对应的枚举
    public static DeviceStatusType fromNumber(int number) {
        for (DeviceStatusType nce : DeviceStatusType.values()) {
            if (nce.getNumber() == number) {
                return nce;
            }
        }
        throw new IllegalArgumentException("未知的数字: " + number);
    }
}
